# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models

# Create your models here.

class Project(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, unique=True)
    start_date = models.DateField()
    target_date = models.DateField()
    end_date = models.DateField()
    created_on = models.DateTimeField(auto_now_add=True)
    created_by = models.ForeignKey(User)
    is_active = models.BooleanField(default=True)

class Issue(models.Model):
    id = models.AutoField(primary_key=True)
    summary = models.CharField(max_length=255)
    description = models.TextField()
    created_on = models.DateTimeField(auto_now_add=True)
    created_by = models.ForeignKey(User)
    is_active = models.BooleanField(default=True)

class Audit(models.Model):
    id = models.AutoField(primary_key=True)
    modified_on = models.DateTimeField(auto_now_add=True)
    modified_by = models.ForeignKey(User)

class Project_Audit(models.Model):
    project = models.ForeignKey(Project, "id")
    audit = models.ForeignKey(Audit, "id")

class Issue_Audit(models.Model):
    issue = models.ForeignKey(Issue, "id")
    audit = models.ForeignKey(Audit, "id")

class UserProfile(models.Model):
    id = models.AutoField(primary_key=True)
    active = models.BooleanField(default=True)